<template>
  <view class="news-container">
    <view class="selectNav">
      <view
        class="selectItem"
        :class="type == 1 ? 'active' : ''"
        @click="handeChange(1)"
      >
        <view class="selectText">留言消息</view>
        <image class="selectIcon" src="@/static/images/tab-line.png"></image>
      </view>
      <view
        class="selectItem"
        :class="type == 2 ? 'active' : ''"
        @click="handeChange(2)"
      >
        <view class="selectText">消息通知</view>
        <image class="selectIcon" src="@/static/images/tab-line.png"></image>
      </view>
    </view>
    <view class="listBox">
      <!-- 留言消息 -->
      <leaveMessage v-if="type == 1"></leaveMessage>
      <!-- 消息通知 -->
      <noticeMessage v-if="type == 2"></noticeMessage>
    </view>
  </view>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { onReachBottom } from "@dcloudio/uni-app";
import leaveMessage from "./components/leaveMessage.vue";
import noticeMessage from "./components/noticeMessage.vue";

let type = ref(1);
const handeChange = (value: number) => {
  type.value = value;
};

onReachBottom(() => {
	console.log(123)
})
</script>

<style lang="scss" scoped>
.news-container {
  .selectNav {
    position: fixed;
    top: calc(0px + env(safe-area-inset-top));
    padding-top: 8rpx;
    z-index: 100;
    width: 100%;
    height: 110rpx;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    .selectItem {
      width: 50%;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      .selectText {
        font-weight: normal;
        font-size: 30rpx;
        color: #666666;
      }
      .selectIcon {
        display: none;
      }
    }
    .active {
      .selectText {
        font-weight: normal;
        font-size: 38rpx;
        color: #222222;
      }
      .selectIcon {
        display: block;
        width: 56rpx;
        height: 18rpx;
        margin-top: 7rpx;
      }
    }
  }
  .selectNav:before {
    content: "";
    width: 100%;
    height: 8rpx;
    background-color: #f5f9ff;
    position: absolute;
    top: 0rpx;
    left: 0;
  }
  .listBox {
    margin-top: calc(118rpx + env(safe-area-inset-top));
    padding-bottom: 218rpx;
    :deep(.uni-list) {
      background-color: transparent;
      .uni-list-item {
        width: calc(100% - 120rpx);
        border-radius: 16rpx;
        overflow: hidden;
        .border--left::after {
          background-color: transparent;
        }
        .uni-list-item__container {
          padding: 20rpx 0 !important;
        }
      }
      .noticeList {
        background-color: #f5f9ff !important;
        width: calc(100% - 60rpx);
        .uni-list-item {
          width: 100%;
          border-radius: 16rpx;
          overflow: hidden;
        }
        .uni-list-item__container {
          padding: 0 !important;
          display: flex;
          flex-direction: column;
          align-items: center;
          justify-content: center;
        }
      }
    }
  }
}
</style>
